package com.fzq.service.impl;

import com.fzq.service.MaskingStrategy;
import org.springframework.stereotype.Component;

@Component
public class CustomMaskingStrategy implements MaskingStrategy {

    /**
     * 自定义策略
     * @param value 原始字符串
     * @param pattern 脱敏模式（可选）
     * @return
     */
    @Override
    public String mask(String value, String pattern) {
        if (value == null || pattern == null || pattern.isEmpty()) {
            return value;
        }
        return value.replaceAll(pattern, "****");
    }
}
